/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package it.polimi.deib.se2.meteocal.business.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import javax.validation.constraints.NotNull;

@Entity(name="NOTIFICATIONS")
public class Notification implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @NotNull
    private Long id;
    
    private String details;
    
    @Temporal(javax.persistence.TemporalType.TIMESTAMP)
    private Date notifDate;
    
    //notification pings one user
    @ManyToOne
    @JoinColumn(name="userPinged", referencedColumnName="email")
    private User userPinged;
    
    //notification refers to one event
    @ManyToOne
    @JoinColumn(name="referingEvent", referencedColumnName="id")
    private Event referingEvent;
    
    //notification may have one invitation
    @OneToOne(mappedBy="notification_id")
    private Invitation invitation;
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @return the details
     */
    public String getDetails() {
        return details;
    }

    /**
     * @param details the details to set
     */
    public void setDetails(String details) {
        this.details = details;
    }

    /**
     * @return the date
     */
    public Date getDate() {
        return notifDate;
    }

    /**
     * @param notifDate the date to set
     */
    public void setDate(Date notifDate) {
        this.notifDate = notifDate;
    }

    /**
     * @return the userPinged
     */
    public User getUserPinged() {
        return userPinged;
    }

    /**
     * @param userPinged the userPinged to set
     */
    public void setUserPinged(User userPinged) {
        this.userPinged = userPinged;
    }

    /**
     * @return the referingEvent
     */
    public Event getReferingEvent() {
        return referingEvent;
    }

    /**
     * @param referingEvent the referingEvent to set
     */
    public void setReferingEvent(Event referingEvent) {
        this.referingEvent = referingEvent;
    }

    /**
     * @return the invitation
     */
    public Invitation getInvitation() {
        return invitation;
    }

    /**
     * @param invitation the invitation to set
     */
    public void setInvitation(Invitation invitation) {
        this.invitation = invitation;
    }
}
